<div class="in author">
	<h2>
	Thống kê doanh thu chi tiết
	</h2>
	<p class="txt_desc">* Đơn vị tính: VNĐ</p>
</div>
<div class="line"></div>

<div class="in forms">
	<form action="" method="get" name="form1" id="form1">

	<p><strong>Xem theo tháng</strong><br>
	<input type="text" class="box" name="month" style="width:100px;" id="month_calendar"> <input type="submit" value="Xem" class="com_btn" tabindex="5" id="submit" name="submit"></p>
	<script>
	$(function() {
		$("#month_calendar" ).datepicker({
		dateFormat: "yy-mm",
		maxDate: "+0d",
		changeMonth: true,
        changeYear: true
		});
	});
	</script>
	</form>
	<?php if(!$err): ?>
	<div class="line"></div>
	<script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Ngày', 'Doanh thu'],
		  <?php
		  if(!empty($month_data)){
			$str = '';
			$i = 0;
			foreach($month_data as $date => $earning){
				if($i < sizeof($month_data)){
					$str = ',';
				}
				else{
					$str = '';
				}
				echo "['".$date."',  $earning]".$str;
				
				$i++;
			}
		  }
		  ?>
        ]);

        var options = {
          title: 'Biểu đồ doanh thu <?php echo $str_date; ?>',
          hAxis: {title: 'Năm', titleTextStyle: {color: 'red'}},
		  backgroundColor:'whitesmoke',
		  pointSize: 8,
		  lineWidth:3,
		  vAxis: {format:'###,###,###'},
		  format:'#,###$',
		  tooltip:{trigger:'hover'}
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
		var formatter = new google.visualization.NumberFormat({
			pattern: '###,###,### VND',
			fractionDigits: 0
		});

		formatter.format(data, 1);
        chart.draw(data, options);
      }
    </script>
	<div id="chart_div" style="height: 500px;"></div>
	<?php else: ?>
	<h2>Chưa có dữ liệu <?php echo $str_date; ?></h2>
	<?php endif; ?>
</div>